package cn.com.infosec.ra.dao.perusercertdao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.com.infosec.ra.entity.PerUserCertEntity;
import cn.com.infosec.ra.util.Pagination;

public interface PerUserCertDao {

	public void addPerUserCert(PerUserCertEntity perUserCertEntity);

	public void updatePerUserCertbyId(PerUserCertEntity perUserCert);

	@Select("select * from ins_userinfo where certdn=#{certdn}")
	public PerUserCertEntity findUserCertByCertDN(String certdn);

	@Select("select * from ins_userinfo where certsn=#{certsn}")
	public PerUserCertEntity findUserCertByCertSN(String certsn);

	public void updatePerUserCertbyCertDN(PerUserCertEntity perUserCert);

	@Select("select * from ins_userinfo where accountholdername=#{accountholdername} and cardtype1 = #{cardtype1} and nationality = #{nationality} and cardnum1 = #{cardnum1}")
	public PerUserCertEntity findUserCert(
			@Param(value = "accountholdername") String accountholdername,
			@Param(value = "cardtype1") int cardtype1,
			@Param(value = "nationality") int nationality,
			@Param(value = "cardnum1") String cardnum1);

	public List<PerUserCertEntity> queryUserCertUnCheckedByPager(
			@Param(value = "perUserCertList") Pagination<PerUserCertEntity> perUserCertList,
			@Param(value = "organId") int organId);

	@Select("select * from ins_userinfo where checkStatus != 99 and organId =#{organId}")
	public List<PerUserCertEntity> queryUserCertUnChecked(int organId);

	@Select("select * from ins_userinfo where id=#{id}")
	public PerUserCertEntity findUserCertById(long id);

	public List<PerUserCertEntity> queryUserCertByConditions(
			@Param(value = "perUserCertConmand") PerUserCertEntity perUserCertConmand,
			@Param(value = "endTime") String endTime,
			@Param(value = "beginTime") String beginTime,
			@Param(value = "organId") int organId,
			@Param(value = "oprAccount") String oprAccount);

	public List<PerUserCertEntity> queryUserCertByConditionsInPager(
			@Param(value = "perUserCertConmand") PerUserCertEntity perUserCertConmand,
			@Param(value = "perUserCertList") Pagination<PerUserCertEntity> perUserCertList,
			@Param(value = "endTime") String endTime,
			@Param(value = "beginTime") String beginTime,
			@Param(value = "organId") int organId,
			@Param(value = "oprAccount") String oprAccount);

	public void updatePerUserCertBaseInfo(PerUserCertEntity perUserCert);

	public void addPerUserCertOracle(PerUserCertEntity perUserCert);

	public List<PerUserCertEntity> queryUserCertUnCheckedByPagerOracle(
			@Param(value = "perUserCertList") Pagination<PerUserCertEntity> perUserCertList,
			@Param(value = "organId") int organId);

	public List<PerUserCertEntity> queryUserCertByConditionsInPagerOracle(
			@Param(value = "perUserCertConmand") PerUserCertEntity perUserCertConmand,
			@Param(value = "perUserCertList") Pagination<PerUserCertEntity> perUserCertList,
			@Param(value = "endTime") String endTime,
			@Param(value = "beginTime") String beginTime,
			@Param(value = "organId") int organId,
			@Param(value = "oprAccount") String oprAccount);
}
